home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / DESK / CORE / Desk / h_doc / Drag < prev    next >
Text File  |  1996-05-21  |  3KB  |  105 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Drag.h
  12.     Author:  Copyright © 1994 Jason Williams
  13.     Version: 1.00 (01 April 1994)
  14.     Purpose: Automatic handling of drag update and finish events
  15. */
  16.  
  17. #ifndef __Desk_Drag_h
  18. #define __Desk_Drag_h
  19.  
  20. #ifdef __cplusplus
  21.     extern "C" {
  22. #endif
  23.  
  24.  
  25. #ifndef __Desk_Core_h
  26.     #include "Core.h"
  27. #endif
  28.  
  29.  
  30. extern void Desk_Drag_Initialise(Desk_bool attachNULLhandler);
  31. /*
  32. This function initialises the drag system for use with the Event
  33. sublibrary, registering Desk_Handler_DragNULL and Desk_Handler_DragFinish with
  34. Event.
  35.  
  36. If you don't use Event, you'll need to do something along similar lines
  37. for yourself.
  38.  
  39. attachNULLhandler should be Desk_bool_TRUE if you want to use an update handler
  40. (for e.g. redrawing a selection as the user drags), or Desk_bool_FALSE if you do
  41. not want an update handler ever (if, e.g. the only drags you use are for
  42. file saves etc where the WIMP/DragASpr takes care of all redrawing)
  43.  
  44. (See below for a description of how dragging should be done)
  45. */
  46.  
  47.  
  48. /*  Drag handlers ------------------------------------------------------------
  49.  *  During a drag, the currentupdate proc is called on each NULL event
  50.  *  When a drag operation completes, currentcomplete proc is called.
  51.  *  The userdata is passed in to both of these functions to indicate
  52.  *  just what drag is being updated.
  53.  *  (See below)
  54.  */
  55.  
  56. typedef void (* Desk_drag_handler) (void *userdata);
  57.  
  58. extern Desk_drag_handler Desk_drag_currentupdate;
  59. extern Desk_drag_handler Desk_drag_currentcomplete;
  60. extern void         *Desk_drag_currentuserdata;
  61.  
  62.  
  63. extern void Desk_Drag_SetHandlers(Desk_drag_handler uproc, Desk_drag_handler cproc,
  64.                              void *userdata);
  65. /*
  66. When you wish to do a drag operation, do the following:
  67.  
  68. * Call Desk_Wimp_DragBox (or equivalent) as appropriate to start the WIMP 
  69.   dragging.
  70.  
  71. * Call Desk_Drag_SetHandlers to set the procedures that will be called on
  72.   each NULL event during dragging, and on completion of the drag
  73.   operation.
  74.  
  75. * Sit back, and let the event handlers do all (well, some of) the work.
  76.  
  77. Your handler(s) may be NULL, in which case that handler is not called.
  78.  
  79. 'userdata' is anything you wish, and is passed into your handlers for
  80. convenience.
  81.  
  82. Your handlers should each be a Desk_drag_handler.
  83.  
  84. eg.
  85.  
  86. void MyDragUpdateHandler(void *myuserdata)
  87. {
  88. (e.g. Get Mouse info and redraw selection)
  89. }
  90.  
  91. void MyDragFinishHandler(void *myuserdata)
  92. {
  93. (e.g. Set new selection,
  94. or save a file if dragging an icon, etc)
  95. }
  96. */
  97.  
  98.  
  99. #ifdef __cplusplus
  100. }
  101. #endif
  102.  
  103.  
  104. #endif
  105.